#@adminLayout()
#define main()
###页面显示的按钮 C:增加按钮,R:查询按钮/清空查询按钮,U:修改按钮,D:删除按钮,I:Excel导入按钮,E:Excel导出按钮,O:tr中操作列,B:checkBox复选框,S:self自定义
#set(map={C:1,R:1,U:1,D:1,I:0,E:0,O:1,B:1,S:1},
aTh = [ "企业","编号","名称",  "IP地址",  "端口",    "状态",  "连接时间",  "断开时间",   "运行总时间" ,"删除状态"],
aTd = [  "eId","code","name",  "ip",  "port",    "state",  "connectionAt",  "disconnectionAt",   "runningTime","isDel" ])
<div class="card">
   #@cardIndex("设备信息管理 / 设备的详情","ciis/equipment",map,aTh,aTd)
</div>
#end

###条件模糊查询
#define cardQuery()
<div class="col-sm-4">
    <div class="form-group">
        <lable><i class="zmdi zmdi-label-alt zmdi-hc-fw"></i>名称</lable>
        <input type="text" name="name" value="#(model.name??)"
               class="form-control" placeholder="请输入名称">
        <i class="form-group__bar"></i>
    </div>
</div>
<div class="col-sm-4">
    <div class="form-group">
        <lable><i class="zmdi zmdi-label-alt zmdi-hc-fw"></i>编号</lable>
        <input type="text" name="code" value="#(model.code??)"
               class="form-control" placeholder="请输入编号">
        <i class="form-group__bar"></i>
    </div>
</div>
<div class="col-sm-4">
    <div class="form-group">
        <lable><i class="zmdi zmdi-label-alt zmdi-hc-fw"></i>状态</lable>
        <select name="state" class="select2">
            <option value="">全部</option>
            <option value="0">离线</option>
            <option value="1">在线</option>
        </select>
        <i class="form-group__bar"></i>
    </div>
</div>

#end
<script src="/assets/app/table.js?v=#(resource_version)"></script>

#define cardBlock()
#for(x : page.getList()??)
<div class="col-sm-12 col-md-4">
    <div class="tab-container tab-container--green">
        <div class="card-title text-info">#(x.name)</div>
        <ul class="nav nav-tabs nav-fill" role="tablist">
            <li class="nav-item">
                <a class="nav-link active" data-toggle="tab" href="#basic-#(x.id)" role="tab"
                   aria-expanded="true">基本信息</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" data-toggle="tab" href="#valve-#(x.id)" role="tab" a
                   ria-expanded="false">阀门信息</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" data-toggle="tab" href="#sensor-#(x.id)" role="tab"
                   aria-expanded="false">传感器信息</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" data-toggle="tab" href="#operate-#(x.id)" role="tab"
                   aria-expanded="false">操作</a>
            </li>
        </ul>
        <div class="tab-content">
            <div class="tab-pane fade active show" id="basic-#(x.id)" role="tabpanel" aria-expanded="true">
                <ul class="icon-list">
                    <li>编号:#(x.code)</li>
                    <li>IP地址:#(x.ip)</li>
                    <li>端口:#(x.port)</li>
                    <li>状态:#if(x.state ==1) <span class="text-success">在线</span> #else <span class="text-danger">离线</span> #end
                    </li>
                    <li>连接时间:#(x.connectionAt)</li>
                    <li>断开时间:#(x.disconnectionAt)</li>
                    <li>运行总时间:#(x.runningTime)</li>
                </ul>
            </div>
            <div class="tab-pane fade" id="valve-#(x.id)" role="tabpanel" aria-expanded="false">
                <ul class="icon-list">
                    #for(y: x.getValveArray())
                    <li>阀门#(for.count):#(y)</li>
                    #end
                </ul>
            </div>
            <div class="tab-pane fade" id="sensor-#(x.id)" role="tabpanel" aria-expanded="false">
                <ul class="icon-list">
                    #for(z: x.get('now_data'))
                    <li>#(z.key):#(z.value)</li>
                    #else
                    <li class="text-danger">设备不在线</li>
                    #end
                </ul>
            </div>
            <div class="tab-pane fade" id="operate-#(x.id)" role="tabpanel" aria-expanded="false">
                <ul class="icon-list">
                    #permission("/admin/ciis/equipment/connectInfo")
                    <li><a data-pjax class="dropdown-item" href="/admin/ciis/equipment/connectInfo?id=#(x.id)&p=1&s=10"><i
                            class="zmdi zmdi-eye zmdi-hc-fw"></i>连接记录</a></li>
                    #end
                    #permission("/admin/ciis/equipment/configure")
                    <li><a data-pjax class="dropdown-item" href="/admin/ciis/equipment/configure?id=#(x.id)"><i
                            class="zmdi zmdi-settings zmdi-hc-fw"></i>配置传感器</a></li>
                    #end

                    <li><a data-pjax class="dropdown-item" href="/admin/ciis/equipment/plan?id=#(x.id)"><i
                            class="zmdi zmdi-settings zmdi-hc-fw"></i>灌溉计划</a></li>
                </ul>
            </div>
        </div>
    </div>
</div>
#end
#end

